/*
*    Author : heiden deng(dengjianquan@beyondcent.com)
*    2017/05/15
*    version 0.0.9
*    zookeeper注册中心工厂接口函数定义
*/

#ifndef HTSC_ZK_REGISTRY_SERVICE_H
#define HTSC_ZK_REGISTRY_SERVICE_H

#ifdef __cplusplus
extern "C" {
#endif

#include "url.h"
#include "registry_service.h"

//接口实现
void zk_start(registry_service_args_t *param);
void zk_registe(registry_service_args_t *param, url_t *url);
void zk_unregiste(registry_service_args_t *param, url_t *url);
void zk_subscribe(registry_service_args_t *param, url_t *url, registry_notify_f notify);
void zk_unsubscribe(registry_service_args_t *param, url_t *url, registry_notify_f notify);
void zk_lookup(registry_service_args_t *param, url_t *src, url_t **result, int *len);
char* zk_getData(registry_service_args_t *param, char *path);
void zk_stop(registry_service_args_t *param);
void zk_destroy(registry_service_args_t *param);



//工具类函数
/**
* 返回url对应注册中心服务路径，例如,/dubbo/com.htsc.example.hello
**/
char *zk_get_service_path(url_t *url);

/**
*返回url对应注册中心的路径，到catogory为止，例如/dubbo/com.htsc.example.hello/providers
**/
char *zk_get_category_path(url_t *url);

/**
*返回url对应的注册中心全路径，包括子节点节点名
*
**/
char *zk_get_url_path(url_t *url);



#ifdef __cplusplus
}
#endif
#endif // !HTSC_ZK_REGISTRY_SERVICE_H
